import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContactInfoVO, ContactInfoForm, ContactInfoQuery } from '@/api/nursing/contactInfo/types';

/**
 * 查询联系人信息列表
 * @param query
 * @returns {*}
 */

export const listContactInfo = (query?: ContactInfoQuery): AxiosPromise<ContactInfoVO[]> => {
  return request({
    url: '/nursing/contactInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询联系人信息详细
 * @param contactId
 */
export const getContactInfo = (contactId: string | number): AxiosPromise<ContactInfoVO> => {
  return request({
    url: '/nursing/contactInfo/' + contactId,
    method: 'get'
  });
};

/**
 * 新增联系人信息
 * @param data
 */
export const addContactInfo = (data: ContactInfoForm) => {
  return request({
    url: '/nursing/contactInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改联系人信息
 * @param data
 */
export const updateContactInfo = (data: ContactInfoForm) => {
  return request({
    url: '/nursing/contactInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除联系人信息
 * @param contactId
 */
export const delContactInfo = (contactId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/contactInfo/' + contactId,
    method: 'delete'
  });
};
